package com.xinzhidi.web.dataanalysis.controller;


import com.xinzhidi.common.core.controller.BaseController;
import com.xinzhidi.common.core.domain.AjaxResult;
import com.xinzhidi.web.dataanalysis.domain.po.DataAnalysisPo;
import com.xinzhidi.web.dataanalysis.service.DataAnalysisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 数据分析
 *
 * @author cx
 * @date 2023-05-29
 */
@RestController
@Api(tags = "数据分析")
@RequestMapping("/dataAnalysis")
@RequiredArgsConstructor
public class DataAnalysisController extends BaseController {

    private final DataAnalysisService analysisService;

    @ApiOperation("故障分析")
    @PostMapping("/faultAnalysis")
    public AjaxResult faultAnalysis(@Validated @RequestBody DataAnalysisPo po) {
        return AjaxResult.success(analysisService.faultAnalysis(po));
    }

    @ApiOperation("数据总览")
    @PostMapping("/dataOverview")
    public AjaxResult dataOverview(@Validated @RequestBody DataAnalysisPo po) {
        return AjaxResult.success(analysisService.dataOverview(po));
    }

    @ApiOperation("热量分析（瞬时热量）")
    @PostMapping("/heatAnalysis")
    public AjaxResult heatAnalysis(@Validated @RequestBody DataAnalysisPo po) {
        return AjaxResult.success(analysisService.heatAnalysis(po));
    }

    @ApiOperation("流量分析（瞬时流量）")
    @PostMapping("/velocityFlowAnalysis")
    public AjaxResult velocityFlowAnalysis(@Validated @RequestBody DataAnalysisPo po) {
        return AjaxResult.success(analysisService.velocityFlowAnalysis(po));
    }

    @ApiOperation("温度分析（室内温度）")
    @PostMapping("/temperatureAnalysis")
    public AjaxResult temperatureAnalysis(@Validated @RequestBody DataAnalysisPo po) {
        return AjaxResult.success(analysisService.temperatureAnalysis(po));
    }

    @ApiOperation("温度分析（室外温度）")
    @PostMapping("/outTemperatureAnalysis")
    public AjaxResult outTemperatureAnalysis(@Validated @RequestBody DataAnalysisPo po) {
        return AjaxResult.success(analysisService.outTemperatureAnalysis(po));
    }

    @ApiOperation("供水温度")
    @PostMapping("/waterSupplyTemperatureAnalysis")
    public AjaxResult waterSupplyTemperatureAnalysis(@Validated @RequestBody DataAnalysisPo po) {
        return AjaxResult.success(analysisService.waterSupplyTemperatureAnalysis(po));
    }

    @ApiOperation("回水温度")
    @PostMapping("/returnWaterTemperatureAnalysis")
    public AjaxResult returnWaterTemperatureAnalysis(@Validated @RequestBody DataAnalysisPo po) {
        return AjaxResult.success(analysisService.returnWaterTemperatureAnalysis(po));
    }

}
